﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using RazorTemplateEngine;
using System.Diagnostics;
using System.Web.Compilation;
using System.Collections;
using System.Reflection;
using System.Text.RegularExpressions;
using Microsoft.CSharp;
using System.IO;
using System.CodeDom.Compiler;
using ModelTest;

namespace RazorLab
{
    public class TestController : TemplateController
    {
        public ActionResult Action1()
        {
            TemplateData["Title"] = "Hello";
            TemplateData["Students"] = new List<Student> { 
                new Student{ID = 0 ,Name = "Parker Zhou"},
                new Student{ID = 1 ,Name = "Sue Kuang"}
            };
            return Template(@"..\..\..\RazorLab\Template\Test\Action1.cshtml");
        }

        public ActionResult Action2()
        {
            TemplateData["Title"] = "Hello";
            TemplateData["Students"] = new List<Student> { 
                new Student{ID = 0 ,Name = "Parker Zhou"},
                new Student{ID = 1 ,Name = "Sue Kuang"}
            };
            return Template(@"..\..\..\RazorLab\Template\Test\Action2.cshtml");
        }
    }


    [TestClass]
    public class RazorTemplateEngin_TemplateController
    {
        /// <summary>
        /// before run the test , plz uncheck ReadOnly of the file "..\..\..\RazorLab\Template\Test\Action1.cshtml" 
        /// </summary>
        [TestMethod]
        public void TestMethod1()
        {
            TestController tc = new TestController();
            Debug.WriteLine(TemplateDriver.Drive(tc.Action1()));
        }
    }
}
